<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text" placeholder="员工姓名" id="d1">
<input type="text" placeholder="工资" id="d2">
<input type="text" placeholder="工作" id="d3">
<input type="button" value="添加" onclick="f()">

<table border="1">
    <caption>员工列表</caption>
    <tr>
        <td>员工姓名</td>
        <td>工资</td>
        <td>工作</td>
    </tr>
</table>

<script>

    function f() {
        //创建tr和td标签
        let tr = document.createElement("tr");
        let td1 = document.createElement("td");
        let td2 = document.createElement("td");
        let td3 = document.createElement("td");

        //给td设置显示的文本
        td1.innerText=d1.value;
        td2.innerText=d2.value;
        td3.innerText=d3.value;

        //将td放入tr中
        tr.append(td1,td2,td3);

        //将tr装进table中
        let table=document.querySelector("table");
        table.append(tr);
    }

</script>
</body>
</html>